package com.kanqiubao.kq.http;

import com.kanqiubao.kq.utils.common.LogUtils;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.convert.StringConvert;
import com.lzy.okgo.request.BaseRequest;

import okhttp3.Response;


/**
 * Created by Dennis on 2017/9/24.
 */

public abstract class StringResponeListener extends StringCallback {
    @Override
    public void onBefore(@SuppressWarnings("rawtypes") BaseRequest request) {
        HeadersUtils.getInstance().requestHeader(request);
        super.onBefore(request);
    }

    @Override
    public String convertSuccess(Response response) throws Exception {
        String t = StringConvert.create().convertSuccess(response);
        LogUtils.i("success---"+t);
        response.setBodyString(t);
        return t;
    }
}
